var LodashTest = {
    Array:{
        chunk:function(func){
            // 循环随机测试n次
            for(var n=0;n<100;n++){
                console.log('测试'+n);
                var array = Mock.createOfRange(1,Mock.randomInRange(4,20));
                var size = Mock.randomInRange(-2,10);
                console.log('参数：Array:'+JSON.stringify(array)+'\nsize:'+size);
                var result = func(array,size);
                var answer = _.chunk(array,size);
                if(JSON.stringify(result)!==JSON.stringify(answer)){
                    console.error('测试'+n+'错误',result,answer)
                }else{
                    console.log('测试'+n+'通过')
                }
            }
        },
        compact:function(func){
                var array = [0, 1, false, 2, '', 3,0,null,undefined,5/0,NaN];
                console.log('参数：Array:'+JSON.stringify(array));
                var result = func(array);
                var answer = _.compact(array);
                if(JSON.stringify(result)!==JSON.stringify(answer)){
                    console.error('测试错误',result,answer)
                }else{
                    console.log('测试通过')
                }
        },
        concat:function(func){
            var array = [0, 1];
            var values = [1,2,[3],[[4]]]
            console.log('参数',array,values);
            var result = func(array,values[0],values[1],values[2],values[3]);
            var answer = _.concat(array,values[0],values[1],values[2],values[3]);
            if(JSON.stringify(result)!==JSON.stringify(answer)){
                console.error('测试错误',result,answer)
            }else{
                console.log('测试通过')
            }
        },
        difference:function(func){
            var array = [0, 1];
            var values = [[1,2],[3],[[4]],0]
            console.log('参数',array,values);
            var result = func(array,values[0],values[1],values[2],values[3]);
            var answer = _.difference(array,values[0],values[1],values[2],values[3]);
            if(JSON.stringify(result)!==JSON.stringify(answer)){
                console.error('测试错误',result,answer)
            }else{
                console.log('测试通过')
            }
        },
        differenceBy:function(func){
            console.log('TEST 1');
            var result1 = func([2.1, 1.2], [2.3, 3.4], Math.floor);
            var answer1 = _.differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor);
            if(JSON.stringify(result1)!==JSON.stringify(answer1)){
                console.error('测试错误',result1,answer1)
            }else{
                console.log('测试通过')
            }
            console.log('TEST 2');
            var result2 = func([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
            var answer2 = _.differenceBy([{ 'x': 2 }, { 'x': 1 }], [{ 'x': 1 }], 'x');
            if(JSON.stringify(result2)!==JSON.stringify(answer2)){
                console.error('测试错误',result2,answer2)
            }else{
                console.log('测试通过')
            }
        }
    }

};